import java.util.Arrays;

public class BubbleSort {
    public  static int[] bubbleSort(int[] arr){
        for (int i = 0; i < arr.length-1; i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if(arr[j]>arr[j+1]){
                    int tmp = arr[j];
                    arr[j]=arr[j+1];
                    arr[j+1]=tmp;
                }
            }
        }
        return arr;
    }

    public static void main(String[] args) {
        System.out.println( Arrays.toString(bubbleSort(new int[]{9, 8, 5, 6, 7, 5, 6, 2, 4, 98, 5, 87, 2, 6, 2, 0, 5, 5, 9})));
    }
}
